﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using HotelManagement.DAO;
using MainMenu;

namespace Login
{
    public partial class Login : Form
    {
        HotelManagement.DAO.StaffDAO dao;

        public Login()
        {
            InitializeComponent();

            dao = new HotelManagement.DAO.StaffDAO();
        }

        private void enter(object sender, EventArgs e)
        {
            int permision = dao.Signin(account.Text, password.Text);
            if (permision > 0)
            {
                MainMenu.MainMenu menu = new MainMenu.MainMenu(this);

                menu.activatePermision(permision);
                menu.Show();

                this.Hide();
            }
            else
            {
                MessageBox.Show("Wrong username or password.");
            }
        }

        private void quitForm(object sender, EventArgs e)
        {
            this.Close();
        }       
    }
}